package com.demo.clazz;

import static jdk.nashorn.internal.objects.Global.print;

public class Cleanser {      //清洁员
    private String s ="cleanser.......";
    public String append(String a){
        return  s+=a;
    }
    //稀释；冲淡；削弱
    public void dilute(){
        append("dilute......");
    }
    public void apply(){
        append("apply......");
    }
    public void scrub(){append("scrub......");}
    public String toString(){return s;}

    public static void main(String[] args) {
        Cleanser cleanser = new Cleanser();
        cleanser.dilute();
        cleanser.apply();
        cleanser.scrub();
//        print(cleanser);
        System.out.println(cleanser);
    }
}

//清洁剂；去垢剂
class Detergent extends Cleanser{
    public void scrub(){
        append("detergent.scrub......");
        super.scrub();
    }
    public void foam(){
        append("foam.....");
    }

    public static void main(String[] args) {
        Detergent detergent = new Detergent();
        detergent.scrub();
        detergent.apply();
        detergent.dilute();
        detergent.foam();
        System.out.println(detergent);
        System.out.print("testing base class:");
        Cleanser.main(args);
    }
}

class Qingjie extends Detergent{
    public static void main(String[] args) {
        Qingjie qingjie = new Qingjie();
        qingjie.scrub();
    }
    public void scrub(){
        super.scrub();
    }
}